<?php

class ConferenceElementRecord extends TActiveRecord
{
	const TABLE = 'conference_elements';
	
	// fields
	/**
	 * @var integer $id
	 * @soapproperty
	 */
	public $id;
	/**
	 * @var string $name
	 * @soapproperty
	 */
	public $name;
	/**
	 * @var boolean $is_session
	 * @soapproperty
	 */
	public $is_session;
	/**
	 * @var string $start_datetime
	 * @soapproperty
	 */
	public $start_datetime;
	/**
	 * @var integer $duration
	 * @soapproperty
	 */
	public $duration;
	/**
	 * @var double $price
	 * @soapproperty
	 */
	public $price;
	/**
	 * @var integer $quantity
	 * @soapproperty
	 */
	public $quantity;
	/**
	 * @var string $description
	 * @soapproperty
	 */
	public $description;
	/**
	 * @var integer $owner_id
	 * @soapproperty
	 */
	public $owner_id;
	/**
	 * @var integer $place_id
	 * @soapproperty
	 */
	public $place_id;
	/**
	 * @var integer $is_plan
	 * @soapproperty
	 */
	public $is_plan;
	
	/**
	 * @var PlaceRecord $place
	 * @soapproperty
	 */
	public $place;
	
	public static $RELATIONS = array
    (
		'place'	=> array(self::BELONGS_TO, 'PlaceRecord', 'place_id'),
	);
	
	public function getId()              { return $this->id; }
	public function getName()            { return $this->name; }
	public function getIsSession()       { return $this->is_session; }
	public function getStartDatetime()   { return $this->start_datetime; }
	public function getDuration()        { return $this->duration; }
	public function getPrice()           { return $this->price; }
	public function getQuantity()        { return $this->quantity; }
	public function getDescription()     { return $this->description; }
	public function getOwnerId()         { return $this->owner_id; }
	public function getPlaceId()         { return $this->place_id; }
	public function getIsPlan()          { return $this->is_plan; }
	
	public function setId($id)                          { $this->id = $id; }
	public function setName($name)                      { $this->name = $name; }
	public function setIsSession($is_session)           { $this->is_session = $is_session; }
	public function setStartDatetime($start_datetime)   { $this->start_datetime = $start_datetime; }
	public function setDuration($duration)              { $this->duration = $duration; }
	public function setPrice($price)                    { $this->price = $price; }
	public function setQuantity($quantity)              { $this->quantity = $quantity; }
	public function setDescription($description)        { $this->description = $description; }
	public function setOwnerId($owner_id)               { $this->owner_id = $owner_id; }
	public function setPlaceId($place_id)               { $this->place_id = $place_id; }
	public function setIsPlan($is_plan)                 { $this->is_plan = $is_plan; }
	
	public function setData($id, $name, $is_session, $start_datetime, $duration, $price, $quantity,
							$description, $owner_id, $place_id, $is_plan)
	{
		$this->id = $id;
		$this->name = $name;
		$this->is_session = $is_session;
		$this->start_datetime = $start_datetime;
		$this->duration = $duration;
		$this->price = $price;
		$this->quantity = $quantity;
		$this->description = $description;
		$this->owner_id = $owner_id;
		$this->place_id = $place_id;
		$this->is_plan = $is_plan;
	}
	
	public function setDataByConferenceElementRecord($record)
	{
		if($record instanceof ConferenceElementRecord)
		{
			$this->setData(	$record->getId(), $record->getName(), $record->getIsSession(),
							$record->getStartDatetime(), $record->getDuration(), $record->getPrice(),
							$record->getQuantity(), $record->getDescription(), $record->getOwnerId(),
							$record->getPlaceId(), $record->getIsPlan());
		}
	}
	
	public function equals($record)
	{
		if($record instanceof ConferenceElementRecord)
		{
			return	$this->getName() == $record->getName()						&&
					$this->getIsSession() == $record->getIsSession()			&&
					$this->getStartDatetime() == $record->getStartDatetime()	&&
					$this->getDuration() == $record->getDuration()				&&
					$this->getPrice() == $record->getPrice()					&&
					$this->getQuantity() == $record->getQuantity()				&&
					$this->getDescription() == $record->getDescription()		&&
					$this->getOwnerId()== $record->getOwnerId()					&&
					$this->getPlaceId() == $record->getPlaceId()				&&
					$this->getIsPlan() == $record->getIsPlan();
		}
		return false;
	}
	
	public static function finder($className=__CLASS__)
	{
		return parent::finder($className)->with_place();
	}
}

?>